/*
 * @Author: laladuduqq 2807523947@qq.com
 * @Date: 2025-07-23 16:15:21
 * @LastEditors: laladuduqq 2807523947@qq.com
 * @LastEditTime: 2025-07-23 16:15:25
 * @FilePath: \niu\serialmanager.cpp
 * @Description: 
 */
#ifndef SERIAL_MANAGER_H
#define SERIAL_MANAGER_H
#include <QObject>
#include <QSerialPort>
#include <QSerialPortInfo>

class SerialManager : public QObject
{
    Q_OBJECT
public:
    explicit SerialManager(QObject *parent = nullptr);
    ~SerialManager();

    void open(const QString &portName, qint32 baudRate);
    void close();
    void send(const QByteArray &data);

signals:
    void received(const QByteArray &data);

private slots:
    void onReadyRead();

private:
    QSerialPort serial;
};
#endif
